package com.woniu.controller.operation;

import com.woniu.controller.BaseController;
import com.woniu.entity.Result;
import com.woniu.service.IOrderService;
import com.woniu.vo.OrderWithUserIdVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("//unclaimedOrder")
@Api(tags = "查询未认领订单")
public class UnclaimedOrder extends BaseController {

    @Autowired
    private IOrderService orderService;

    /**
     * 巡检员查询超过5分钟未认领的订单
     * @param patrolId 巡检员id
     * @return 返回未认领的订单
     */
    @GetMapping("//{patrolId}")
    @ApiOperation("巡检员查询超过5分钟未认领的订单")
    public Result queryUnclaimedOrder(@PathVariable Long patrolId) {
        List<OrderWithUserIdVo> orderList = orderService.queryUnclaimedOrder(patrolId);
        return toDataResult(orderList);
    }

}
